package crazy.serializable;

import java.io.FileInputStream;
import java.io.ObjectInputStream;

public class ReadTeacher
{
	public static void main(String[] args)
	{
		ObjectInputStream ois = null;
		try
		{
			ois = new ObjectInputStream(new FileInputStream("c:\\a.txt"));
			Teacher t1 = (Teacher) ois.readObject();
			Teacher t2 = (Teacher) ois.readObject();
			Person p = (Person) ois.readObject();
			Teacher t3 = (Teacher) ois.readObject();
			
			System.out.println(t1.getStudent() == p);
			System.out.println(t2.getStudent() == p);
			System.out.println(t2 == t3);
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		finally
		{
			try
			{
				if (ois != null)
				{
					ois.close();
				}
			}
			catch (Exception e2)
			{
				// TODO: handle exception
				e2.printStackTrace();
			}
		}
	}
}
